package com.qjy.sqldemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.qjy.bean.AddressBean;

public class MainActivity extends AppCompatActivity {
    private SQLiteUtils sqLiteUtils;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        sqLiteUtils = new SQLiteUtils(this);
        AddressBean addressBean=new AddressBean();
        addressBean.setAddressUrl("http://www.baidu.com");
        sqLiteUtils.insertAddress(addressBean);
        addressBean.setAddressUrl("https://www.hao123.com/");
        sqLiteUtils.insertAddress(addressBean);
        addressBean.setAddressUrl("https://www.360.cn/");
        sqLiteUtils.insertAddress(addressBean);
        addressBean.setAddressUrl("https://github.com/");
        sqLiteUtils.insertAddress(addressBean);
        addressBean.setAddressUrl("https://www.jd.com/");
        sqLiteUtils.insertAddress(addressBean);


        findViewById(R.id.bt_delete).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,""+sqLiteUtils.selectAddress("https://www.taobao.com/"),Toast.LENGTH_SHORT).show();
//                System.out.println("---------->"+sqLiteUtils.selectAddress("https://www.taobao.com/"));
            }
        });
        findViewById(R.id.bt_delete1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,""+sqLiteUtils.selectAddress("https://www.360.cn/"),Toast.LENGTH_SHORT).show();
//                System.out.println("---------->"+sqLiteUtils.selectAddress("https://www.360.cn/"));
            }
        });

    }
}
